<?php
namespace app\common\model;
use app\common\model\CommonModel;
use think\Db;

class Supplier extends CommonModel
{
	/**
	* 添加供应商
	*/
	public function setSupplier($data)
	{
		return $this->insert($data);
	}
    /**
	* 修改供应商信息
	*/
	public function updateSupplier($where,$data)
	{
		return $this->where($where)->update($data);
	}
	/**
	* 获取供应商列表
	*/
	public function getSupplierList($where,$limit = 10,$page)
	{
	   $item = $this->where($where)->paginate($limit,false,['page'=>$page]);
       return empty($item) ? array():$item->toArray();
	}
	/**
	* 获取供应商列表
	*/
	public function supplierList($where,$field)
	{
	   $item = $this->where($where)->field($field)->select();
       return empty($item) ? array():$item->toArray();
	}
	/**
	* 删除一条信息
	*/
	public function delSuppliers($where)
	{
		return $this->where($where)->delete();
	}
	/**
	* 获取字段信息
	*/
	public function fieldSuppliers($where,$field)
	{
		return $this->where($where)->value($field);
	}
}
